package se.plingapp.controllerbeans;

import java.util.List;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import se.plingapp.entitybeans.Comment;
import se.plingapp.enterprisebeans.CommentFacade;

/**
 * User controller.
 *
 * (AT THE MOMENT THIS ACTS AS PLACEHOLDER CLASS)
 *
 * @author Jens Björk
 */
@ManagedBean
@RequestScoped
public class CommentController {

    @EJB
    private CommentFacade commentFacade;

    private Comment comment = new Comment();

    public Comment getComment() {
        return this.comment;
    }

    public List<Comment> getCommentList() {
        return commentFacade.findAll();
    }

    public String showCreate() {
        return "/admin/comment/create.xhtml";
    }

    public String showEdit() {
        return "admin/comment/edit.xhtml";
    }
    
    public String doCreate() {
        comment = commentFacade.create(comment);
        return this.showEdit();
    }

    public String doEdit() {
        // Edit user
        return this.showEdit();
    }

    public String doDelete() {
        // Delete user
        return this.showEdit();
    }
}
